home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-06-28 | 1.7 KB | 91 lines | [TEXT/CWIE] |
- // Key.h
-
- #ifndef Key_h
- #define Key_h
-
- #ifndef Integers_h
- #include "Integers.h"
- #endif
-
- class KCHRCache;
-
- class Key
- {
- public:
- enum KeyCode
- {
- returnKey = 0x24,
-
- tabKey = 0x30,
- deleteKey = 0x33,
- escapekey = 0x35,
-
- clearKey = 0x47,
- enterKey = 0x4c,
-
- function5 = 0x60,
- function6 = 0x61,
- function7 = 0x62,
- function3 = 0x63,
- function8 = 0x64,
- function9 = 0x65,
- function11 = 0x67,
- function13 = 0x69,
- function14 = 0x6b,
- function10 = 0x6d,
- function12 = 0x6f,
-
- function15 = 0x71,
- helpKey = 0x72,
- homeKey = 0x73,
- pageUpKey = 0x74,
- forwardDeleteKey = 0x75,
- function4 = 0x76,
- endKey = 0x77,
- function2 = 0x78,
- pageDownKey = 0x79,
- function1 = 0x7a,
- leftArrow = 0x7b,
- rightArrow = 0x7c,
- downArrow = 0x7d,
- upArrow = 0x7e,
- power = 0x7f,
-
- stopKey = 0x80,
- unknown = 0x81
- };
-
- private:
- KeyCode code;
- uint8 character;
-
- void Normalize();
- void CheckCharacter();
- void CheckForStop();
-
- static const uint8 functionNumbers[ 0x20 ];
-
- public:
- Key( const EventRecord& );
-
- KeyCode Code() const { return code; }
- uint8 Character() const { return character; }
-
- bool operator==( Key k ) const
- { return code == k.code && character == k.character; }
-
- bool operator!=( Key k ) const { return !( *this == k ); }
-
- bool Special() const;
- bool ForTyping() const { return !Special(); }
- bool IsFunctionKey() const;
- uint32 FunctionNumber() const;
-
- static KCHRCache *GetKCHRCache();
-
- uint16 WithModifiers( EventModifiers ) const;
- uint16 WithModifiers( EventModifiers, KCHRCache *kchrResource ) const;
- };
-
- #endif
-